/*
 * ecx_mod.c
 * Clunix, cezanne@clunix.com, 2005.11
 *
 * Copyright (c) 2001-2005 by Clunix Inc. All Rights Reserved.
 */

#include "config.h"

#include "edbd.h"
#include "edbd_ecx.h"
#include "edbd_conn.h"
#include "edbroot.h"

static void
mod_ecx_push_error(ecx_err_t err, const char *msg)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	push_error(conn->ecx->info, err, "%s", msg);
}

static ECMBOOL
mod_ecx_process_entity(const sr_t *sr_base, const sr_t *sr_stage)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	return process_entity(conn->ecx, sr_base, sr_stage, NULL);
}

static sr_t *
mod_ecx_get_self(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	return conn->ecx->sr_self;
}

static const char *
mod_ecx_get_stage(ecm_uint32 stageidx)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx;

	ecx = conn->ecx;
	while (stageidx > 0) {
		ecx = ecx->ecx_super;
		if (ecx == NULL)
			return NULL;
		stageidx--;
	}
	return ecx->ESTAGE;
}

static sr_t *
mod_ecx_get_parent(sr_t *sr)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	return ecxroot_get_parent(conn->ecxroot, sr);
}

static sr_t *
mod_ecx_get_ctxval(ecm_uint32 row, ecm_uint32 col)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	sr_t	*sr_ctxval;

	sr_ctxval = edbd_get_ctxval(conn->ecx, row, col);
	conn_insert_ghost(conn, sr_ctxval);
	return sr_ctxval;
}

static ecm_uint32
mod_ecx_get_ctxval_rowcount(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	return get_ctxval_rowcount(conn->ecx);
}

static void
mod_ecx_printf(const char *fmt, va_list ap)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	char	*buf;

	ecm_vasprintf(&buf, fmt, ap);
	UNKNOWN(conn->ecx, buf, ECM_FALSE);
	ecm_free(buf);
}

static void
mod_ecx_printf_raw(const char *fmt, va_list ap)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	char	*buf;
	
	ecm_vasprintf(&buf, fmt, ap);
	UNKNOWN(conn->ecx, buf, ECM_TRUE);
	ecm_free(buf);
}

static const char *
mod_ecx_username(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);

	return conn->username;
}

static const char *
mod_ecx_sessionid(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);

	return conn->sessionid;
}

static const sr_t *
mod_ecx_arg(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);

	return conn->ecx->sr_ARG;
}

static ECMBOOL
mod_ecx_is_editing(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);

	if (conn->ecx->state == ECX_APPLYING)
		return ECM_FALSE;
	return dom_ecx_has_form(conn->ecx);
}

static ECMBOOL
mod_ecx_is_applying(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);

	if (conn->ecx->state != ECX_APPLYING)
		return ECM_FALSE;
	if (conn->ecx->applying)
		return ECM_TRUE;
	return dom_ecx_has_form(conn->ecx);
}

static ECMBOOL
mod_ecx_is_showing(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);

	if (conn->ecx->state == ECX_APPLYING)
		return ECM_FALSE;
	if (dom_ecx_has_form(conn->ecx))
		return ECM_FALSE;
	return ECM_TRUE;
}

static void
mod_ecx_reg_private(ecm_cptr_t priv)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);

	conn->ecx->private = priv;
}

static ecm_cptr_t
mod_ecx_get_private(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);

	return conn->ecx->private;
}

static const char *
mod_ecx_parent_ctxcls(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx_super;
	sr_t		*sr_CTX;
	eds_ctx_t	*ctx_cur;

	if ((ecx_super = conn->ecx->ecx_super) == NULL)
		return NULL;
	if ((sr_CTX = sr_prev(ecx_super->sr_CTX)) == NULL)
		return NULL;
	if ((ctx_cur = eds_get_ctx(sr_get_type(ecx_super->sr_self), sr_get_str(sr_CTX))) == NULL)
		return NULL;
	return ctx_cur->ctxcls->clsname;
}

static ECMBOOL
mod_ecx_has_supplementary(const char *clsname)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t		*ecx;
	srt_t		srt;
	sr_t		*sr_CTX;
	eds_ctx_t	*ctx;

	ecx = conn->ecx;
	srt = sr_get_type(ecx->sr_self);
	for (sr_CTX = sr_prev(ecx->sr_CTX); sr_CTX; sr_CTX = sr_prev(sr_CTX)) {
		ctx = eds_get_ctx(srt, sr_get_str(sr_CTX));
		if (ecm_strcmp(ctx->ctxcls->clsname, clsname) == 0)
			return ECM_TRUE;
	}
	return ECM_FALSE;
}

static ECXATTR_t
mod_ecx_attr(ECXATTR_t ATTR, va_list ap)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return createv_attrset(ecx, ATTR, ap);
}

static void
mod_ecx_add_attr(ECXDOM_t DOM, const char *attr, const char *value)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	dom_add_attr(ecx, DOM, attr, value);
}

static void
mod_ecx_set_attr(ECXDOM_t DOM, ECXATTR_t ATTR)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	dom_set_attr(ecx, DOM, ATTR);
}

static ECMBOOL
mod_ecx_set_content(const char *path)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return edbd_ecx_set_content(ecx, path);
}

static char *
mod_ecx_ESTAGE(const sr_t *sr_stage)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	if (sr_stage == NULL)
		return conn->ecx->ESTAGE;
	return mangle_escaped_stage(ecx, sr_stage);
}

static char *
mod_ecx_EARG(const sr_t *sr_arg)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return mangle_escaped_arg(ecx, sr_arg);
}

static const char *
mod_ecx_DOM_ID(ECXDOM_t DOM)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return DOM_ID(ecx, DOM);
}

static ECXDOM_t
mod_ecx_FORM_BEGIN(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return FORM_BEGIN(ecx);
}

static void
mod_ecx_FORM_END(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	FORM_END(ecx);
}

static void
mod_ecx_FORM_BUTTON(const char *embid, ecx_formbutton_t button)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	FORM_BUTTON(ecx, embid, button);
}

static void
mod_ecx_ACTION_BUTTON(const char *name, const char *embid, ECXDOM_t DOM, const char *value)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	ACTION_BUTTON(ecx, name, embid, DOM, value);
}

static void
mod_ecx_NOFORM_BEGIN(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	edbd_ecx_NOFORM_BEGIN(ecx);
}

static void
mod_ecx_NOFORM_END(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	edbd_ecx_NOFORM_END(ecx);
}

static ECXDOM_t
mod_ecx_TEXT(const char *name, const char *text)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return edbd_ecx_TEXT(ecx, name, text);
}

static void
mod_ecx_POPUP_BEGIN(sr_t *sr_stage, const char *name, int wt, int ht)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	POPUP_BEGIN(ecx, sr_stage, name, wt, ht);
}

static void
mod_ecx_POPUP_END(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	POPUP_END(ecx);
}

static void
mod_ecx_POPUP_FORM_BUTTON(const char *embid, ecx_formbutton_t button, char *action)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	POPUP_FORM_BUTTON(ecx, embid, button, action);
}

static ECXDOM_t
mod_ecx_GROUP_BEGIN(const char *name, const char *empty_desc, const char *empty_selection_desc)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return GROUP_BEGIN(ecx, name, empty_desc, empty_selection_desc);
}

static void
mod_ecx_GROUP_END(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	GROUP_END(ecx);
}

static ECXDOM_t
mod_ecx_FIELD(const char *name, const char *desc, const char *rule, const char *fmt, va_list ap, const sr_t *sr_stage)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return FIELDv(ecx, name, desc, rule, fmt, ap, sr_stage);
}

static ECXDOM_t
mod_ecx_TEXTAREA(const char *name, const char *msg)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return TEXTAREA(ecx, name, msg);
}

static ECXDOM_t
mod_ecx_PASSWORD(const char *name, const char *DOM_ID, const char *mismatch_desc)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return edbd_ecx_PASSWORD(ecx, name, DOM_ID, mismatch_desc);
}

static ECXDOM_t
mod_ecx_BUTTON(const char *name, const char *caption, ECXATTR_t ATTR)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return BUTTON(ecx, name, caption, ATTR);
}

static ECXDOM_t
mod_ecx_RADIO(const char *name, const char *fmt, va_list ap, ECXATTR_t ATTR)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return RADIOv(ecx, name, fmt, ap, ATTR);
}

static ECXDOM_t
mod_ecx_CHECKBOX(const char *name, const char *fmt, va_list ap, ECXATTR_t ATTR)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return CHECKBOXv(ecx, name, fmt, ap, ATTR);
}

static void
mod_ecx_BR(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;

	edbd_ecx_BR(ecx);
}

static ECXDOM_t
mod_ecx_NOBR_BEGIN(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return edbd_ecx_NOBR_BEGIN(ecx);
}

static void
mod_ecx_NOBR_END(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	edbd_ecx_NOBR_END(ecx);
}

static ECXDOM_t
mod_ecx_SPAN_BEGIN(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return edbd_ecx_SPAN_BEGIN(ecx);
}

static void
mod_ecx_SPAN_END(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	edbd_ecx_SPAN_END(ecx);
}

static ECXDOM_t
mod_ecx_IFRAME(const char *name, int second, ECXATTR_t ATTR)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return IFRAME(ecx, name, second, ATTR);
}

static ECXDOM_t
mod_ecx_HIDDEN(const char *name, const char *fmt, va_list ap)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return HIDDENv(ecx, name, fmt, ap);
}

static ECXDOM_t
mod_ecx_UPLOAD(const char *name, const char *empty_desc)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return UPLOAD(ecx, name, empty_desc);
}

static ECXDOM_t
mod_ecx_FILE_BROWSE(const char *name, const char *empty_desc)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return FILE_BROWSE(ecx, name, empty_desc);
}

static ECMBOOL
mod_ecx_DOWNLOAD_BEGIN(ebc_ndid_t ndid, const char *path, const char *fname)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return DOWNLOAD_BEGIN(ecx, ndid, path, fname);
}

static void
mod_ecx_DOWNLOAD_END(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	DOWNLOAD_END(ecx);
}

static ECMBOOL
mod_ecx_DOWNLOAD(ebc_ndid_t ndid, const char *path)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return DOWNLOAD(ecx, ndid, path);
}

static ECXDOM_t
mod_ecx_OBJECT_BEGIN(const char *name, const char *embid, const char *version)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return edbd_ecx_OBJECT_BEGIN(ecx, name, embid, version);
}

static void
mod_ecx_OBJECT_END(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	edbd_ecx_OBJECT_END(ecx);
}

static ECXDOM_t
mod_ecx_PARAM(const char *name, const char *value)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return edbd_ecx_PARAM(ecx, name ,value);
}

static const sr_t *
mod_ecx_get_GROUP(const char *name)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return get_GROUP(ecx, name);
}

static const char *
mod_ecx_get_FIELD(const char *name, va_list ap)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return getv_FIELD(ecx, name, ap);
}

static const char *
mod_ecx_get_PASSWORD(const char *name)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return edbd_ecx_get_PASSWORD(ecx, name);
}

static const char *
mod_ecx_get_RADIO(const char *name, va_list ap)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return getv_RADIO(ecx, name, ap);
}

static const sr_t *
mod_ecx_get_CHECKBOX(const char *name, va_list ap)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return getv_CHECKBOX(ecx, name, ap);
}

static const sr_t *
mod_ecx_get_SELECT(const char *name) 
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return get_SELECT(ecx, name);
}

static const char *
mod_ecx_get_UPLOAD(const char *name)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return get_UPLOAD(ecx, name);
}

static const char *
mod_ecx_get_FILE_BROWSE(const char *name)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return get_FIELD(ecx, name);
}

static const char *
mod_ecx_get_user(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	return conn->username;
}

static ECXDOM_t
mod_ecx_SELECT_BEGIN(const char *name, ECMBOOL submit_all, ECMBOOL multiple)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return edbd_ecx_SELECT_BEGIN(ecx, name, submit_all, multiple);
}

static void
mod_ecx_SELECT_END(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	edbd_ecx_SELECT_END(ecx);
}

static ECXDOM_t
mod_ecx_OPTION(ECMBOOL selected, const char *value)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return edbd_ecx_OPTION(ecx, selected, value);
}

static ECXDOM_t
mod_ecx_IMG(const char *name, const char *embid, const sr_t *sr_stage)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return IMG(ecx, name, embid, sr_stage);
}

static void
mod_ecx_IMGSRC(const ecm_uint8 *buf, ecm_size_t size)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	ecx_info_t	*info;

	if (ecx) {
		info = ecx->info;
		if (info->sr_imgsrc == NULL)
			info->sr_imgsrc = sr_create_oct(ST_OCT, size, buf);
	}
}

static ECXDOM_t
mod_ecx_TABLE_BEGIN(ECXATTR_t ATTR)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return TABLE_BEGIN(ecx, ATTR);
}

static void
mod_ecx_TABLE_END(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	TABLE_END(ecx);
}

static ECXDOM_t
mod_ecx_TR(ECXATTR_t ATTR)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return TR(ecx, ATTR);
}

static ECXDOM_t
mod_ecx_TD(ECXATTR_t ATTR)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return TD(ecx, ATTR);
}

static ECXDOM_t
mod_ecx_DIV_BEGIN(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return DIV_BEGIN(ecx);
}

static void
mod_ecx_DIV_END(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	DIV_END(ecx);
}

static void
mod_ecx_SANCHOR(ecx_sanchor_mode_t mode, const sr_t *sr_anchor, const sr_t *sr_stage)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	edbd_ecx_SANCHOR(ecx, mode, sr_anchor, sr_stage);
}

static ECXDOM_t
mod_ecx_SANCHOR_BEGIN(ecx_sanchor_mode_t mode, const char *name,
		     const sr_t *sr_stage, const char *confirm_msg)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	return SANCHOR_BEGIN(ecx, mode, name, sr_stage, confirm_msg);
}

static void
mod_ecx_SANCHOR_END(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	SANCHOR_END(ecx);
}

static ECMBOOL
mod_ecx_BACK(ECMBOOL abortive, ecm_uint32 nsteps)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;

	return edbd_ecx_BACK(ecx, abortive, nsteps);
}

static void
mod_ecx_DYNAMIC_BEGIN(ECMBOOL enabled)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	DYNAMIC_BEGIN(ecx, enabled);
}

static void
mod_ecx_DYNAMIC_END(void)
{
	conn_t	*conn = edbd_conn_get(ECM_FALSE);
	ecx_t	*ecx = conn->ecx;
	DYNAMIC_END(ecx);
}

static eds_ecx_funcs_t	edbd_ecx_funcs = {
	mod_ecx_push_error,
	mod_ecx_process_entity,
	mod_ecx_get_self,
	mod_ecx_get_stage,
	mod_ecx_get_parent,
	mod_ecx_get_ctxval,
	mod_ecx_get_ctxval_rowcount,
	mod_ecx_printf,
	mod_ecx_printf_raw,
	mod_ecx_username,
	mod_ecx_sessionid,
	mod_ecx_arg,

	mod_ecx_is_editing,
	mod_ecx_is_applying,
	mod_ecx_is_showing,

	mod_ecx_reg_private,
	mod_ecx_get_private,

	mod_ecx_parent_ctxcls,
	mod_ecx_has_supplementary,

	mod_ecx_attr,
	mod_ecx_add_attr,
	mod_ecx_set_attr,

	mod_ecx_set_content,

	mod_ecx_ESTAGE,
	mod_ecx_EARG,
	mod_ecx_DOM_ID,

	mod_ecx_FORM_BEGIN,
	mod_ecx_FORM_END,
	mod_ecx_FORM_BUTTON,
	mod_ecx_ACTION_BUTTON,
	mod_ecx_NOFORM_BEGIN,
	mod_ecx_NOFORM_END,
	mod_ecx_TEXT,
	mod_ecx_POPUP_BEGIN,
	mod_ecx_POPUP_END,
	mod_ecx_POPUP_FORM_BUTTON,
	mod_ecx_GROUP_BEGIN,
	mod_ecx_GROUP_END,
	mod_ecx_FIELD,
	mod_ecx_TEXTAREA,
	mod_ecx_PASSWORD,
	mod_ecx_BUTTON,
	mod_ecx_RADIO,
	mod_ecx_CHECKBOX,
	mod_ecx_BR,
	mod_ecx_NOBR_BEGIN,
	mod_ecx_NOBR_END,
	mod_ecx_SPAN_BEGIN,
	mod_ecx_SPAN_END,
	mod_ecx_IFRAME,
	mod_ecx_HIDDEN,
	mod_ecx_UPLOAD,
	mod_ecx_FILE_BROWSE,
	mod_ecx_DOWNLOAD_BEGIN,
	mod_ecx_DOWNLOAD_END,
	mod_ecx_DOWNLOAD,
	mod_ecx_OBJECT_BEGIN,
	mod_ecx_OBJECT_END,
	mod_ecx_PARAM,
	mod_ecx_get_GROUP,
	mod_ecx_get_FIELD,
	mod_ecx_get_PASSWORD,
	mod_ecx_get_RADIO,
	mod_ecx_get_CHECKBOX,
	mod_ecx_get_SELECT,
	mod_ecx_get_UPLOAD,
	mod_ecx_get_FILE_BROWSE,
	mod_ecx_get_user,
	mod_ecx_SELECT_BEGIN,
	mod_ecx_SELECT_END,
	mod_ecx_OPTION,
	mod_ecx_IMG,
	mod_ecx_IMGSRC,
	mod_ecx_TABLE_BEGIN,
	mod_ecx_TABLE_END,
	mod_ecx_TR,
	mod_ecx_TD,
	mod_ecx_DIV_BEGIN,
	mod_ecx_DIV_END,
	mod_ecx_SANCHOR,
	mod_ecx_SANCHOR_BEGIN,
	mod_ecx_SANCHOR_END,
	mod_ecx_BACK,
	mod_ecx_DYNAMIC_BEGIN,
	mod_ecx_DYNAMIC_END,
};

void
ecx_initialize(void)
{
	eds_ecx_funcs = &edbd_ecx_funcs;
}
